package com.personal.kousuan.factory;

import java.util.HashMap;
import java.util.Map;

import com.personal.kousuan.generator.KouSuanGenerator;
import com.personal.kousuan.generator.grade12.LessThan100BuJieWeiMinusOneDigit;
import com.personal.kousuan.generator.grade12.LessThan100BuJieWeiMinusWholeDozen;
import com.personal.kousuan.generator.grade12.LessThan100BuJinWeiPlusOneDigit;
import com.personal.kousuan.generator.grade12.LessThan100BuJinWeiPlusWholeDozen;
import com.personal.kousuan.generator.grade12.LessThan100ContinousMinus;
import com.personal.kousuan.generator.grade12.LessThan100ContinousPlus;
import com.personal.kousuan.generator.grade12.LessThan100JieWeiMinusOneDigit;
import com.personal.kousuan.generator.grade12.LessThan100JieWeiMinusTwoDigit;
import com.personal.kousuan.generator.grade12.LessThan100JinWeiPlusOneDigit;
import com.personal.kousuan.generator.grade12.LessThan100JinWeiPlusTwoDigit;

public class KouSuanGeneratorFactory {

	private static KouSuanGeneratorFactory instance;
	private KouSuanGeneratorFactory(){}
	public static final String GRADE1_SECOND_100_BUJINWEI_PLUS_WHOLE_DOZEN = "GRADE1_SECOND_100_BUJINWEI_PLUS_WHOLE_DOZEN";
	public static final String GRADE1_SECOND_100_BUJINWEI_PLUS_ONE_DIGIT = "GRADE1_SECOND_100_BUJINWEI_PLUS_ONE_DIGIT";
	public static final String GRADE1_SECOND_100_BUJIEWEI_MINUS_WHOLE_DOZEN = "GRADE1_SECOND_100_BUJIEWEI_MINUS_WHOLE_DOZEN";
	public static final String GRADE1_SECOND_100_BUJIEWEI_MINUS_ONE_DIGIT = "GRADE1_SECOND_100_BUJIEWEI_MINUS_ONE_DIGIT";
	
	public static final String GRADE1_SEMESTER1_PLUS_WITHIN_10 = "1";
	public static final String GRADE1_SEMESTER1_MINUS_WITHIN_10 = "2";
	public static final String GRADE1_SEMESTER1_CONT_PLUS_WITHIN_10 = "4";
	public static final String GRADE1_SEMESTER1_CONT_MINUS_WITHIN_10 = "5";
	public static final String GRADE1_SEMESTER1_BUJINWEI_PLUS_WITHIN_20 = "7";
	public static final String GRADE1_SEMESTER1_BUTUIWEI_MINUS_WITHIN_20 = "8";
	public static final String GRADE1_SEMESTER1_JINWEI_PLUS_WITHIN_20 = "10";
	public static final String GRADE1_SEMESTER1_TUIWEI_MINUS_WITHIN_20 = "11";
	public static final String GRADE1_SEMESTER1_CONT_PLUS_WITHIN_20 = "14";
	public static final String GRADE1_SEMESTER1_CONT_MINUS_WITHIN_20 = "15";
	
	public static final String GRADE1_SEMESTER2_BUJINWEI_PLUS_WHOLEDOZEN_WITHIN_100 = "18";
	public static final String GRADE1_SEMESTER2_BUJINWEI_PLUS_ONEDIGIT_WITHIN_100 = "19";
	public static final String GRADE1_SEMESTER2_BUTUIWEI_MINUS_WHOLEDOZEN_WITHIN_100 = "21";
	public static final String GRADE1_SEMESTER2_BUTUIWEI_MINUS_ONEDIGIT_WITHIN_100 = "22";
	public static final String GRADE1_SEMESTER2_JINWEI_PLUS_ONEDIGIT_WITHIN_100 = "25";
	public static final String GRADE1_SEMESTER2_TUIWEI_MINUS_ONEDIGIT_WITHIN_100 = "26";
	public static final String GRADE1_SEMESTER2_JINWUI_PLUS_TWODIGIT_WITHIN_100 = "28";
	public static final String GRADE1_SEMESTER2_TUIWEI_MINUS_TWODIGIT_WITHIN_100 = "281";
	public static final String GRADE1_SEMESTER2_CONT_PLUS_WITHIN_100 = "29";
	public static final String GRADE1_SEMESTER2_CONT_MINUS_WITHIN_100 = "30";
	
	public static final String GRADE2_SEMESTER1_MULTI = "33";
	public static final String GRADE2_SEMESTER1_DIVID = "34";
	public static final String GRADE2_SEMESTER1_CONT_MULTI = "36";
	public static final String GRADE2_SEMESTER1_CONT_DIVID = "37";
	public static final String GRADE2_SEMESTER1_MULTI_PLUS_MINUS_BUJINBUTUI = "40";
	public static final String GRADE2_SEMESTER1_MULTI_PLUS_MINUS_JINTUI = "41";
	public static final String GRADE2_SEMESTER1_DIVID_PLUS_MINUS_BUJINBUTUI = "42";
	public static final String GRADE2_SEMESTER1_DIVID_PLUS_MINUS_JINTUI = "43";
	
	public static final String GRADE2_SEMESTER2_PLUS_MINUS_HUNDERD = "45";
	public static final String GRADE2_SEMESTER2_PLUS_BUJINWEI_HUNDERD_TEN = "46";
	public static final String GRADE2_SEMESTER2_PLUS_JINWEI_TEN = "47";
	public static final String GRADE2_SEMESTER2_PLUS_JINWEI_HUNDERD_TEN = "48";
	public static final String GRADE2_SEMESTER2_MINUS_BUTUIWEI_HUNDERD_TEN = "49";
	public static final String GRADE2_SEMESTER2_MINUS_TUIWEI_HUNDERD_TEN = "50";
	
	
	private static Map<String,KouSuanGenerator> kousuanGenerateMap = new HashMap<String,KouSuanGenerator>();
	static{
		kousuanGenerateMap.put(GRADE1_SEMESTER2_BUJINWEI_PLUS_WHOLEDOZEN_WITHIN_100, new LessThan100BuJinWeiPlusWholeDozen());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_BUJINWEI_PLUS_ONEDIGIT_WITHIN_100, new LessThan100BuJinWeiPlusOneDigit());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_BUTUIWEI_MINUS_WHOLEDOZEN_WITHIN_100, new LessThan100BuJieWeiMinusWholeDozen());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_BUTUIWEI_MINUS_ONEDIGIT_WITHIN_100, new LessThan100BuJieWeiMinusOneDigit());
		
		kousuanGenerateMap.put(GRADE1_SEMESTER2_JINWEI_PLUS_ONEDIGIT_WITHIN_100, new LessThan100JinWeiPlusOneDigit());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_TUIWEI_MINUS_ONEDIGIT_WITHIN_100, new LessThan100JieWeiMinusOneDigit());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_JINWUI_PLUS_TWODIGIT_WITHIN_100, new LessThan100JinWeiPlusTwoDigit());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_TUIWEI_MINUS_TWODIGIT_WITHIN_100, new LessThan100JieWeiMinusTwoDigit());
		
		kousuanGenerateMap.put(GRADE1_SEMESTER2_CONT_PLUS_WITHIN_100, new LessThan100ContinousPlus());
		kousuanGenerateMap.put(GRADE1_SEMESTER2_CONT_MINUS_WITHIN_100, new LessThan100ContinousMinus());
	}
	public static KouSuanGeneratorFactory getInstance(){
		if(instance == null){
			instance = new KouSuanGeneratorFactory();
		}
		return instance;
	}
	
	public KouSuanGenerator getRandomGenerator(String key){
		return kousuanGenerateMap.get(key);
	}
}
